<template>
  <div class="content-view">

    <div class="table-body">
      <Form ref="formInline" :model="formInline" :rules="ruleInline" label-position="left" :label-width="100">
        <FormItem prop="equity" label='是否启用'>
          <i-switch v-model="formInline.status" :true-value='1' :false-value='0'></i-switch>
        </FormItem>

        <FormItem prop="remark" label='公告内容'>
          <Input type="textarea" :rows="16" :maxlength='500' show-word-limit v-model="formInline.content" placeholder="内容">
          </Input>
        </FormItem>
        <FormItem style="text-align: right;">
          <Button type="primary" @click="handleSave()">保存</Button>
        </FormItem>
      </Form>
    </div>

  </div>
</template>

<script>
import announcementServer from '@/api/system/announcementServer'
export default {
  data() {
    return {
      ruleInline: {},
      formInline: {
        status: 0,
        content: ''
      }
    }
  },
  mounted() {
    this.dtl()
  },
  methods: {
    async dtl() {
      let res = await announcementServer.dtl()
      this.formInline = res.data
    },
    async handleSave() {
      await announcementServer.add(this.formInline)
      await this.dtl()
      rootVue.$Message.success('保存成功！')
    }
  }
}
</script>

<style>
</style>
